package org.spring.boot.multiple.mybatis.ws;

import org.spring.boot.multiple.mybatis.dao.fm.TmptabMapper;
import org.spring.boot.multiple.mybatis.dao.irms.CityMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author: eastcom
 * @desc:
 **/
@RestController
@RequestMapping("/spring/boot/multiple/mybatis")
public class DemoWs {

	@Autowired(required = false)
	private TmptabMapper tmptabMapper;

	@Autowired(required = false)
	private CityMapper cityMapper;

	@RequestMapping(value = "/list/{city_id}", method = RequestMethod.GET)
	public List<Map<String, Object>> queryForList(@PathVariable("city_id") String cityId){
		List<Map<String, Object>> rtList = new ArrayList<>();
		rtList.addAll(this.tmptabMapper.selectForWhere());
		Map<String, Object> paramMap = new HashMap<>(16);
		paramMap.put("city_id", cityId);
		rtList.addAll(this.cityMapper.selectByWhere(paramMap));
		return  rtList;
	}
}
